package lambdasinaction.chap8;

import java.util.function.Consumer;

/**
 * Created by ThinkPad on 2017/8/23.
 */
public class OnlineBankingLambda {

    public static void main(String[] args) {
        new OnlineBankingLambda().processCustomer(1337,
                (Customer c) -> System.out.println("Hello!"));
    }

    public void processCustomer(int id, Consumer<Customer> makeCustomerHappy) {
        Customer c = Database.getCustomerWithId(id);
        makeCustomerHappy.accept(c);
    }

    private static class Customer {}
    private static class Database {
        static Customer getCustomerWithId(int id) {
            return new Customer();
        }
    }
}
